function export_xyz(obj,varargin)
%export atoms to a xyz file

natoms = obj.natoms;
indexes = obj.Atoms.keys;

fid = fopen(char(varargin{1}),'w');
count = fprintf(fid,'%5g\n',natoms);
count = fprintf(fid,'%5s\n',' ');

for ka=1:natoms
    Atom = obj.Atoms(indexes{ka});
    count = fprintf(fid,'%5s',char(Atom.Kind));
    count = fprintf(fid,'%20.6f',Atom.Position(1));
    count = fprintf(fid,'%20.6f',Atom.Position(2));
    count = fprintf(fid,'%20.6f\n',Atom.Position(3));
end
fclose(fid);    
 
end